#include "SkillManager.h"
#include "../data/GameInfo.h"

void SkillManager::OnInput()
{
}

void SkillManager::OnUpdate(double delta)
{
    auto &skills = GameInfo::Instance().skills;
    skills.erase(std::remove_if(skills.begin(), skills.end(),
                                [](std::shared_ptr<Skill> &skill) { return skill->CanRemove(); }), skills.end());
    for (auto &skill: skills) {
        skill->OnUpdate(delta);
    }
}

void SkillManager::OnRender()
{
    for (auto &skill: GameInfo::Instance().skills) {
        skill->OnRender();
    }
}

void SkillManager::AddSkill(const std::shared_ptr<Skill>& skill)
{
    GameInfo::Instance().skills.push_back(skill);
}

